package com.zhkj.txg.utils

import com.zhkj.lib.utils.SPUtil

object ConfigManager {
    private val NAME = "config"
    private val CUSTOMER_MOBILE = "mobile"
    private val FIRST = "first"
    private val GOODS_CONTENT = "goodsContent"
    private val SHARE_TITLE = "title"
    private val SHARE_CONTENT = "content"

    fun saveCustomerMobile(mobile: String) {
        SPUtil.getInstance(NAME)
            .putString(CUSTOMER_MOBILE, mobile)
    }

    fun saveFirstRun(first: Boolean) {
        SPUtil.getInstance(NAME).putBoolean(FIRST, first)
    }

    fun saveProductShareContent(content: String) {
        SPUtil.getInstance(NAME).putString(GOODS_CONTENT, content)
    }

    fun saveShareTitle(title: String) {
        SPUtil.getInstance(NAME).putString(SHARE_TITLE, title)
    }

    fun saveShareContent(content: String) {
        SPUtil.getInstance(NAME).putString(SHARE_CONTENT, content)
    }

    fun getCustomerMobile() = SPUtil.getInstance(NAME).getString(CUSTOMER_MOBILE) ?: ""
    fun getIsFirstRun() = SPUtil.getInstance(NAME).getBoolean(FIRST, true)
    fun getProductShareContent() = SPUtil.getInstance(NAME).getString(GOODS_CONTENT)
    fun getShareTitle() = SPUtil.getInstance(NAME).getString(SHARE_TITLE)
    fun getShareContent() = SPUtil.getInstance(NAME).getString(SHARE_CONTENT)

    fun clear() {
        SPUtil.getInstance(NAME).clear()
    }
}